/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rbh.risk.service.impl;

import com.rbh.risk.dao.MainEventDao;
import com.rbh.risk.entity.Category;
import com.rbh.risk.entity.MainEvent;
import com.rbh.risk.service.MainEventService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("mainEventService")
public class MainEventServiceImpl implements MainEventService {

    @Autowired
    private MainEventDao mainEventDao;

    @Transactional(readOnly = false)
    @Override
    public void insert(MainEvent mainEvent) {
        this.mainEventDao.insert(mainEvent);
    }

    @Transactional(readOnly = false)
    @Override
    public void update(MainEvent mainEvent) {
        this.mainEventDao.update(mainEvent);
    }

    @Transactional(readOnly = false)
    @Override
    public void delete(MainEvent mainEvent) {
        this.mainEventDao.delete(mainEvent);
    }

    @Transactional(readOnly = true)
    @Override
    public MainEvent getById(Integer mainEventId) {
        return this.mainEventDao.getById(mainEventId);
    }

    @Transactional(readOnly = true)
    @Override
    public List<MainEvent> getAll() {
        return this.mainEventDao.getALL();
    }

    @Transactional(readOnly = true)
    @Override
    public List<MainEvent> getByCategory(Category category) {
        return this.mainEventDao.getByCategory(category);
    }
}
